package com.si2.gui.view;

import jason.environment.grid.GridWorldView;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import com.si2.gui.model.AspiradorModel;

public class AspiradorView extends GridWorldView {

	private static final long serialVersionUID = 1L;
	
	private AspiradorModel model;

	public AspiradorView(AspiradorModel model) {
		super(model, AspiradorModel.TITLE, AspiradorModel.WINDOW_SIZE);
		this.model = model;
        defaultFont = new Font("Arial", Font.BOLD, 14);
        setVisible(true);
	}
	
	@Override
	 public void draw(Graphics g, int x, int y, int object) {
         switch (object) {
             case AspiradorModel.LIXOR: 
             case AspiradorModel.LIXOG: 
             case AspiradorModel.LIXOB: 
            	 drawGarb(g, x, y,object);  
            	 break;
         }
     }
		
     @Override
     public void drawAgent(Graphics g, int x, int y, Color c, int id) {
         String label = "Ag"+(id+1);
         c = model.cor[id];
         super.drawAgent(g, x, y, c, -1);
         g.setColor(Color.BLACK);
         super.drawString(g, x, y, defaultFont, label);
         repaint(1000);
     }
		
     public void drawGarb(Graphics g, int x, int y, int LIXO) {
         super.drawObstacle(g, x, y);
         switch(LIXO){
         	case AspiradorModel.LIXOR:
         		g.setColor(Color.red);
         		drawString(g, x, y, defaultFont, Integer.toString(AspiradorModel.uLIXO[0]));
         		break;
         	case AspiradorModel.LIXOG:
         		g.setColor(Color.green);
         		drawString(g, x, y, defaultFont, Integer.toString(AspiradorModel.uLIXO[1]));
         		break;
         	case AspiradorModel.LIXOB:
         		g.setColor(Color.blue);
         		drawString(g, x, y, defaultFont, Integer.toString(AspiradorModel.uLIXO[2]));
         		break;
         }
     }

}
